import * as zrender from "zrender";


/**
 * 根据名称查找组内的矩形元素
 * @param group zrender组对象
 * @param name 矩形元素名称
 * @returns 找到的矩形元素，未找到时返回null
 */
export function findReact(group: zrender.Group, name: string): zrender.Rect | null {
  const rect = group.childOfName(name) as zrender.Rect;
  if (rect) {
    return rect;
  }
  return null;
}


export function findText(group: zrender.Group, name: string): zrender.Text | null {
  const text = group.childOfName(name) as zrender.Text;
  if (text) {
    return text;
  }
  return null;
}